
const ModuleChat = {
  state: {
    chatList: [],
    chatData: {},
    countMsg: 0,
    countFriendMsg: 0,
    chatBackData: {}
  },
  mutations: {
    /**
     * 放入聊天数据
     * @param state
     * @param data
     */
    setChatList(state,data){
      state.chatList.push(data);
    },
    /**
     * 放入聊天数据(直接赋值)
     * @param state
     * @param data
     */
    setChatListData(state,data){
      state.chatList = data;
    },
    /**
     * 放入聊天数据
     * @param state
     * @param data
     */
    setChatData(state,data){
      state.countMsg++;
      state.chatData = data;
      setTimeout(() =>{
        state.chatData = {};
      },100)
    },
    /**
     * 放入聊天发送回执数据
     * @param state
     * @param data
     */
    setChatBackData(state,data){
      state.chatBackData = data;
      setTimeout(() =>{
        state.chatBackData = {};
      },100)
    },
    /**
     * 未读聊天数量
     * @param state
     * @param data
     */
    setCountMsg(state,data){
      state.countMsg = data;
    },
    /**
     * 好友申请消息数量
     * @param state
     * @param data
     */
    setCountFriendMsg(state,data){
      state.countFriendMsg = data;
    },
  },
  actions: {

  },
}

export default ModuleChat;
